{extend name="../../admin/view/main"}

{block name="button"}
{if isset($type) and $type eq 'index'}
<!--{if auth("remove")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary'
        data-action='{:url("remove")}' data-rule="id#{key};deleted#1">删 除</button>
<!--{/if}-->
{else}
<!--{if auth("remove")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary' data-action='{:url("remove")}'
        data-confirm="确定要恢复这些数据吗？" data-rule="id#{key};deleted#0">恢 复
</button>
<!--{/if}-->
{/if}
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        {foreach ['index'=>'全部数据'] as $k=>$v}
        {if isset($type) and $type eq $k}
        <li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}</li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}</li>
        {/if}{/foreach}
    </ul>
    <div class="layui-tab-content">
        {include file='proxy_list_controller/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th>序号</th>
                <th>授权类型</th>
                <th>账号信息</th>
                <th>登录信息</th>
                <th>登录应用</th>
                <th>操作</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class="nowrap">{$key+1}</td>
                <td class="nowrap">
                    <div>
                        {eq name='vo.user_autotype' value='1'}<span class="layui-badge layui-bg-blue">代理</span>{/eq}
                        {eq name='vo.user_autotype' value='2'}<span class="layui-badge layui-bg-cyan">贴牌</span>{/eq}
                        {if $vo.pid eq 1 or $vo.pid eq 2}<span class="layui-badge layui-bg-green">直属</span>{/if}
                    </div>
                    <div>绑定应用：{foreach $apps as $s}{eq name='vo.app_id' value='$s.app_id'}{$s.app_name}{/eq}{/foreach}</div>
                </td>
                <td class="nowrap">
                    <div>
                        昵称：{$vo.user_nickname|default='--'}&nbsp;
                        {eq name='vo.user_state' value='0'}<span class="layui-badge layui-bg-blue">正常</span>{/eq}
                        {eq name='vo.user_state' value='1'}<span class="layui-badge layui-bg-cyan">禁止登录</span>{/eq}
                        &nbsp;当前积分：{$vo.integral_balance}
                    </div>
                    <div>账号：{$vo.user_account|default='--'}</div>
                    <div>上级代理：{foreach $proxys as $s}{eq name='vo.pid' value='$s.id'} <span class="color-blue">[{$s.user_nickname}]{$s.user_account}</span> {/eq}{/foreach}</div>
                    <div>创建时间：{$vo.create_time|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>登录次数：{$vo.login_num|default='--'}</div>
                    <div>登录时间：{$vo.login_time|default='--'}</div>
                    <div>登录IP：{$vo.login_ip|default='--'}</div>
                    <div>登录地区：{$vo.login_address|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>登录APP名称：{$vo.login_appName|default='--'}</div>
                    <div>登录APP包名：{$vo.login_packageName|default='--'}</div>
                    <div>登录APP版本号：{$vo.login_versionName|default='--'}</div>
                    <div>登录APP迭代号：{$vo.login_versionCode|default='--'}</div>
                </td>
                <td class='nowrap sub-strong-blue'>
                    <!--{if auth("userstate")}-->
                    {if $vo.user_state eq '1'}
                    <a class="layui-btn layui-btn-xs" data-action="{:url('userstate')}" data-value="id#{$vo.id};user_state#0">允许登录</a>
                    {else}
                    <a class="layui-btn layui-btn-xs layui-btn-danger" data-action="{:url('userstate')}" data-value="id#{$vo.id};user_state#1">禁止登录</a>
                    {/if}
                    <!--{/if}-->
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>

{/block}
